package com.crm.system.mapper;

import com.crm.entity.SysRegion;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SysRegionMapper {

    @Select("select * from sys_region where region_level=#{regionLevel}")
    List<SysRegion> findByLevel(@Param("regionLevel") int regionLevel);
    @Select("select * from sys_region where parent_id=#{parentId} order by region_id")
    List<SysRegion> findByParentId(String parentId);

    @Select("select * from sys_region where region_level<=#{level} order by sorted desc, region_level,region_id asc")
    List<SysRegion> findByLitLevel(int level);

    @Select("select * from sys_region ")
    List<SysRegion> findAll();
} 
